package com.drug.wms.service.impl;

import com.drug.common.enums.BusinessSeqEnum;
import com.drug.common.utils.DateUtils;
import com.drug.wms.domain.BusCargoSpaceConf;
import com.drug.wms.mapper.BusCargoSpaceConfMapper;
import com.drug.wms.service.GenerateSequence;
import com.drug.wms.service.IBusCargoSpaceConfService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 货位配置Service业务层处理
 *
 * @author ruoyi
 * @date 2021-12-26
 */
@Service
public class BusCargoSpaceConfServiceImpl implements IBusCargoSpaceConfService {
    @Autowired
    private BusCargoSpaceConfMapper busCargoSpaceConfMapper;

    /**
     * 查询货位配置
     *
     * @param id 货位配置主键
     * @return 货位配置
     */
    @Override
    public BusCargoSpaceConf selectBusCargoSpaceConfById(String id) {
        return busCargoSpaceConfMapper.selectBusCargoSpaceConfById(id);
    }

    /**
     * 查询货位配置列表
     *
     * @param busCargoSpaceConf 货位配置
     * @return 货位配置
     */
    @Override
    public List<BusCargoSpaceConf> selectBusCargoSpaceConfList(BusCargoSpaceConf busCargoSpaceConf) {
        return busCargoSpaceConfMapper.selectBusCargoSpaceConfList(busCargoSpaceConf);
    }

    /**
     * 新增货位配置
     *
     * @param busCargoSpaceConf 货位配置
     * @return 结果
     */
    @Override
    public int insertBusCargoSpaceConf(BusCargoSpaceConf busCargoSpaceConf) {
        busCargoSpaceConf.setCreateTime(DateUtils.getNowDate());
        busCargoSpaceConf.setSpaceNo(GenerateSequence.genSeqNo(BusinessSeqEnum.HW.getCode()));
        return busCargoSpaceConfMapper.insertBusCargoSpaceConf(busCargoSpaceConf);
    }

    /**
     * 修改货位配置
     *
     * @param busCargoSpaceConf 货位配置
     * @return 结果
     */
    @Override
    public int updateBusCargoSpaceConf(BusCargoSpaceConf busCargoSpaceConf) {
        busCargoSpaceConf.setUpdateTime(DateUtils.getNowDate());
        return busCargoSpaceConfMapper.updateBusCargoSpaceConf(busCargoSpaceConf);
    }

    /**
     * 批量删除货位配置
     *
     * @param ids 需要删除的货位配置主键
     * @return 结果
     */
    @Override
    public int deleteBusCargoSpaceConfByIds(String[] ids) {
        return busCargoSpaceConfMapper.deleteBusCargoSpaceConfByIds(ids);
    }

    /**
     * 删除货位配置信息
     *
     * @param id 货位配置主键
     * @return 结果
     */
    @Override
    public int deleteBusCargoSpaceConfById(String id) {
        return busCargoSpaceConfMapper.deleteBusCargoSpaceConfById(id);
    }
}
